﻿using System;
namespace RLGDashboard
{
    public class PressureSensor : Sensor
    {
        double[] pressureOffsets = {.25, 0, 0, 0};
        bool firstPsi = true;

        public override object[] convert(UInt16[] inValues)
        {
            object[] convertedValues = new object[4];
            int i = 0;

            foreach (Int16 pressureValue in inValues)
            {
                //Calculate the pressure value
                convertedValues[i] = ((double)(pressureValue) / 10.0) - pressureOffsets[i];

                //Round the pressure value to the nearest half.
                convertedValues[i] = Math.Round((double)convertedValues[i] * 2) / 2.0;
                i++;
            }

            return convertedValues;
        }
/*        public override string[] getValues()
        {
            string[] values = new string[4];
            int i = 0;

            foreach (object temp in currentSensorValues)
            {
                values[i] = temp.ToString() + " PSI";
                i++;
            }

            updated = false;
            return values;
        }*/
    }
}